package fixedv1

func Go(vehicle action) {
    // concrete 具体的，有形的，实在的，实际的;固结成的，混凝土制的;图案诗歌的
    switch concrete := vehicle.(type) {
    case poweredAction:
        concrete.startEngine()
    case unpoweredAction:
        concrete.pushStart()
    }

    vehicle.drive()

}

type action interface {
    drive()
}

type poweredAction interface {
    action
    startEngine()
    stopEngine()
}

type unpoweredAction interface {
    action
    pushStart()
}

type Vehicle struct {
}

func (v Vehicle) drive() {
    // todo

}

type PoeredVehicle struct {
    Vehicle
}

func (v PoeredVehicle) startEngine() {
    // common engine start code
}

type Car struct {
    PoeredVehicle
}

type Sled struct {
    Vehicle
}

func (s Sled) pushStart() {
    // do nothing

}
